﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Lifang.Entites
{
    public partial class DP_CategoryValue
    {
        public const string Id = "Id";
        public const string Name = "Name";
        public const string Level = "Level";
        public const string PName = "PName";
        public const string PId = "PId";
        public const string IdPath = "IdPath";
        public const string NamePath = "NamePath";
        public const string DataFlag = "DataFlag";
        public const string IsDel = "IsDel";
        public const string SortNum = "SortNum";
        public const string ArtId = "ArtId";
        public const string CreateDateTime = "CreateDateTime";
        public const string CreateUserNo = "CreateUserNo";
        public const string CreateUserName = "CreateUserName";
        public const string UpdateDateTime = "UpdateDateTime";
        public const string UpdateUserNo = "UpdateUserNo";
        public const string UpdateUserName = "UpdateUserName";
    }

    public partial class DP_Category : IBaseDbEntity<DP_Category>
    {
        public DP_Category()
        {
            SetDefaultValue();
        }

        #region 方法
        public string GetPkName()
        {
            return "Id";
        }

        public int GetPkValue()
        {
            return Id;
        }


        public string GetDbName()
        {
            return "LifangDB";
        }

        public string GetTableName()
        {
            return "Category";
        }

        public string GetInsertSql()
        {
            return "INSERT INTO LifangDB.Category (Name,Level,PName,PId,IdPath,NamePath,DataFlag,IsDel,SortNum,ArtId,CreateDateTime,CreateUserNo,CreateUserName,UpdateDateTime,UpdateUserNo,UpdateUserName)   VALUES (@Name,@Level,@PName,@PId,@IdPath,@NamePath,@DataFlag,@IsDel,@SortNum,@ArtId,@CreateDateTime,@CreateUserNo,@CreateUserName,@UpdateDateTime,@UpdateUserNo,@UpdateUserName);";
        }

        public string GetSelectSql()
        {
            return "SELECT Id,Name,Level,PName,PId,IdPath,NamePath,DataFlag,IsDel,SortNum,ArtId,CreateDateTime,CreateUserNo,CreateUserName,UpdateDateTime,UpdateUserNo,UpdateUserName  FROM LifangDB.Category WHERE 1=1 ";
        }

        public string ColumnNameForSelect()
        {
            return "Id,Name,Level,PName,PId,IdPath,NamePath,DataFlag,IsDel,SortNum,ArtId,CreateDateTime,CreateUserNo,CreateUserName,UpdateDateTime,UpdateUserNo,UpdateUserName";
        }

        public string ColumnNameForSelectParam()
        {
            return "@Id,@Name,@Level,@PName,@PId,@IdPath,@NamePath,@DataFlag,@IsDel,@SortNum,@ArtId,@CreateDateTime,@CreateUserNo,@CreateUserName,@UpdateDateTime,@UpdateUserNo,@UpdateUserName ";
        }

        public string ColumnNameForUpdate()
        {
            return "Name,Level,PName,PId,IdPath,NamePath,DataFlag,IsDel,SortNum,ArtId,CreateDateTime,CreateUserNo,CreateUserName,UpdateDateTime,UpdateUserNo,UpdateUserName";
        }


        public string ColumnNameForUpdateParam()
        {
            return "@Name,@Level,@PName,@PId,@IdPath,@NamePath,@DataFlag,@IsDel,@SortNum,@ArtId,@CreateDateTime,@CreateUserNo,@CreateUserName,@UpdateDateTime,@UpdateUserNo,@UpdateUserName";
        }


        public Dictionary<string, string> GetFieldNotes()
        {
            return new Dictionary<string, string> { { "Id", "主键" }, { "Name", "类目名" }, { "Level", "层级" }, { "PName", "父类别名" }, { "PId", "父ID" }, { "IdPath", "路径" }, { "NamePath", "路径名" }, { "DataFlag", "有效性" }, { "IsDel", "是否删除" }, { "SortNum", "排序" }, { "ArtId", "文章标识" }, { "CreateDateTime", "创建时间" }, { "CreateUserNo", "创建人工号" }, { "CreateUserName", "创建人名" }, { "UpdateDateTime", "修改时间" }, { "UpdateUserNo", "修改人工号" }, { "UpdateUserName", "修改人名" }, };
        }

        public Dictionary<string, Type> GetFieldNames()
        {
            return new Dictionary<string, Type> { { "Id", typeof(int) }, { "Name", typeof(string) }, { "Level", typeof(int) }, { "PName", typeof(string) }, { "PId", typeof(int) }, { "IdPath", typeof(string) }, { "NamePath", typeof(string) }, { "DataFlag", typeof(int) }, { "IsDel", typeof(int) }, { "SortNum", typeof(int) }, { "ArtId", typeof(int) }, { "CreateDateTime", typeof(DateTime) }, { "CreateUserNo", typeof(string) }, { "CreateUserName", typeof(string) }, { "UpdateDateTime", typeof(DateTime) }, { "UpdateUserNo", typeof(string) }, { "UpdateUserName", typeof(string) }, };
        }

        public void SetDefaultValue()
        {
            if (Name == null) { Name = String.Empty; }
            if (PName == null) { PName = String.Empty; }
            if (IdPath == null) { IdPath = String.Empty; }
            if (NamePath == null) { NamePath = String.Empty; }
            if (CreateDateTime.Year < 1900) { CreateDateTime = new DateTime(1900, 1, 1); }
            if (CreateUserNo == null) { CreateUserNo = String.Empty; }
            if (CreateUserName == null) { CreateUserName = String.Empty; }
            if (UpdateDateTime.Year < 1900) { UpdateDateTime = new DateTime(1900, 1, 1); }
            if (UpdateUserNo == null) { UpdateUserNo = String.Empty; }
            if (UpdateUserName == null) { UpdateUserName = String.Empty; }
        }


        public void SetPkValue(int pkVal)
        {
            Id = pkVal;
        }
        #endregion

        #region 字段

        /// <summary>
        /// 主键
        /// </summary>
        public System.Int32 Id { get; set; }

        /// <summary>
        /// 类目名
        /// </summary>
        public System.String Name { get; set; }

        /// <summary>
        /// 层级 0顶级 
        /// </summary>
        public System.Int32 Level { get; set; }

        /// <summary>
        /// 父类别名
        /// </summary>
        public System.String PName { get; set; }

        /// <summary>
        /// 父ID
        /// </summary>
        public System.Int32 PId { get; set; }

        /// <summary>
        /// 路径
        /// </summary>
        public System.String IdPath { get; set; }

        /// <summary>
        /// 路径名
        /// </summary>
        public System.String NamePath { get; set; }

        /// <summary>
        /// 有效性 0无效 1有效
        /// </summary>
        public System.Int32 DataFlag { get; set; }

        /// <summary>
        /// 是否删除  0否 1是
        /// </summary>
        public System.Int32 IsDel { get; set; }

        /// <summary>
        /// 排序 值越大优先级越大
        /// </summary>
        public System.Int32 SortNum { get; set; }

        /// <summary>
        /// 文章标识
        /// </summary>
        public System.Int32 ArtId { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public System.DateTime CreateDateTime { get; set; }

        /// <summary>
        /// 创建人工号
        /// </summary>
        public System.String CreateUserNo { get; set; }

        /// <summary>
        /// 创建人名
        /// </summary>
        public System.String CreateUserName { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public System.DateTime UpdateDateTime { get; set; }

        /// <summary>
        /// 修改人工号
        /// </summary>
        public System.String UpdateUserNo { get; set; }

        /// <summary>
        /// 修改人名
        /// </summary>
        public System.String UpdateUserName { get; set; }
        #endregion

    }
}
